<!--
 * @Author: your name
 * @Date: 2021-06-16 14:23:25
 * @LastEditTime: 2021-06-16 14:49:07
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vueDemo\07-事件绑定.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>first</title>
    <!-- 引入vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script src=""></script>
</head>

<body>
    <div id="div">
        <div>{{name}}</div>
        <button v-on:click="change()">改变div的内容</button>
        <button v-on:dblclick=change()>改变div的内容</button>
        <button @click="change()">改变div的内容</button>
    </div>
    <script>
        new Vue({
            el: "#div",
            data: {
                name: "黑马程序员"
            },
            methods: {
                change() {
                    names = ["hhh", "xxx", "jjjj"],
                        this.name = names[parseInt(Math.random() * 3)]
                    console.log(parseInt(Math.random() * 3))
                }
            }
        })
    </script>
</body>

</html>